<template>
  <readonly-form :fields="dataFields.data" :data="data" />
</template>

<script>
import { reactive } from "vue";
import { handleFormEmptyData } from "@/tools/filters";
import { useI18n } from "vue-i18n";

export default {
  props: {
    data: {
      type: Object,
      default: () => ({}),
    },
  },
  setup(props, content) {
    const { t } = useI18n();
    const dataFields = reactive({
      data: [
        {
          title: t('order-manage.title.RegistrationInformation'),
          fields: "orderCourseList",
          type: "array",
          childFields: [
            { span: 6, title: t('order-manage.openDialog.projectName'), field: "projectName" },
            { span: 6, title: t('order-manage.openDialog.semester'), field: "semesterName" },
            { span: 6, title: t('order-manage.openDialog.courseName'), field: "courseName" },
            { span: 6, title: t('order-manage.openDialog.price'), field: "price" },
          ],
        },
        {
          title: t('order-manage.title.saleinfo'),
          fields: "orderPolicyList",
          type: "array",
          childFields: [
            { span: 6, title: t('order-manage.title.salepolicy'), field: "policyName" },
            { span: 6, title: t('order-manage.title.policyType'), field: "preType" },
            { span: 6, title: t('order-manage.title.salepricenum'), field: "policyAmount" },
          ],
        },
        {
          title: t('order-manage.title.Paymentinformation'),
          fields: [
            { span: 6, title: t('order-manage.title.is_t_sale'), field: "isSpecial" },
            { span: 6, title: t('order-manage.title.Totalcourse'), field: "totalAmt" },
            { span: 6, title: t('order-manage.title.Totalpreferentia'), field: "discountAmt" },
            { span: 6, title: '特殊优惠金额', field: "specialAmt" },
            { span: 6, title: t('order-manage.title.Totalpayable'), field: "receivableTotalAmt" },
          ],
        },
      ],
    });

    return {
      t,
      dataFields,
      handleFormEmptyData,
    };
  },
};
</script>
